using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using ChrisTec.WindowsMobile.TodayScreen;

namespace AnotherTodayScreenItem
{
  [TodayScreenItem("Stock Ticker")]
  public partial class StockTicker : UserControl
  {
    private int index = 0;
    private string[] quotes = new string[] 
      {
        "ABC: 1234",
        "DEF: 4567",
        "ACA: 123",
        "MBA: 530"
      };

    public StockTicker()
    {
      InitializeComponent();
    }

    private void timer1_Tick(object sender, EventArgs e)
    {
      index = (index + 1) % quotes.Length;
      Invalidate();
    }

    private void StockTicker_Paint(object sender, PaintEventArgs e)
    {
      using (Brush brush = new SolidBrush(TodayScreenColors.Text))
      {
        e.Graphics.DrawString(quotes[index], Font, brush, ClientRectangle);
      }
    }
  }
}
